<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<text class="title">{{title}}</text>
		</view>
		<view class="counter">
			<text class="count">Count: {{ counter.count }}</text>
			<text class="double-count">Double Count: {{ counter.doubleCount }}</text>
			<button @click="counter.increment">+</button>
			<button @click="counter.decrement">-</button>
		</view>
	</view>
</template>

<script setup>
import { ref } from 'vue'
import { useCounterStore } from '../../stores/counter.js'

// 响应式数据
const title = ref('Hello Pinia')

// 使用状态存储
const counter = useCounterStore()
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
	
	.counter {
		margin-top: 50rpx;
		text-align: center;
	}
	
	.count, .double-count {
		display: block;
		margin: 10rpx 0;
		font-size: 32rpx;
	}
	
	button {
		margin: 10rpx;
		padding: 10rpx 20rpx;
		font-size: 28rpx;
	}
</style>